<!DOCTYPE html>
<html>
    
    <head>
        <meta charset="utf-8">
        <title>
            订单详情
        </title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="format-detection" content="telephone=no">
        <link rel="stylesheet" href="./css/x-admin.css" media="all">
    </head>
    
    <body onload="getentername()">
        <div class="x-body">
        	<div class="pd-20">
            	<table class="layui-table">
            		<thead>
            			<tr>
            				<th>下单时间：</th>
            				<th><a id="ordertime" name="ordertime"></a></th>
            			</tr>
            		</thread>
            	</table>
            </div>
            <div class="pd-20">
             <table class="layui-table">
                <thead>
                	
                    <tr>
                       
                        <th>
                            商品名
                        </th>
                        <th>
                            商品价钱
                        </th>
                        <th>
                            商品数量
                        </th>
                       
                    </tr>
                </thead>
                <tbody id="orderslist" name="orderslist">
                </tbody>
            </table>
            <a id="taketime" name="taketime"></a>
            <div class="pd-20">
            	<table class="layui-table">
            			<tr>
            				<th>总金额</th>
            				<th>￥<a id="total" name="total"></a></th>
            			</tr>
            	</table>
            </div>
            </div>
        </div>
        <script src="./lib/layui/layui.js" charset="utf-8">
        </script>
        <script src="./js/x-layui.js" charset="utf-8">
        </script>
         <script src="js/jquery.min.js"></script>
       <script type="text/javascript">
		function getentername(){
			     $('#orderslist').empty();
				        var sum=0;
						 var msg = "";
			for (var i = 0; i < sessionStorage.length; i++) {
				let content=JSON.parse(sessionStorage.getItem(i));
						msg +='<tr>';
			            msg +=' <td>'+content.speciesName+'</td> ';
                        msg +='<td>￥'+content.price+'&nbsp;&nbsp;&nbsp;单位'+content.unitName+ '/g</td> ';
                        msg +='<td>'+ content.orderdetailNumber+'</td>';
                        msg +='</tr>';	
                        sum=sum+content.price*content.orderdetailNumber;
			}
			       $("#total").text(sum);
					$("#orderslist").html(msg);
					$("#ordertime").text(JSON.parse(sessionStorage.getItem(0)).ordertime);
			if(JSON.parse(sessionStorage.getItem(0)).express=="要"){
			
				var html = "";
				html +='<div class=\"pd-20\">';
				html +='<table class=\"layui-table\">';
				html +='<thead>';
				html +='<tr>';
				html +='<td>送货时间：</td>';
				html +='<td><a>'+JSON.parse(sessionStorage.getItem(0)).taketime+'</a></td></tr>';
				html +='<tr><td>送货地址：</td>';
				html +='<td><a>'+JSON.parse(sessionStorage.getItem(0)).location+'</a></td></tr>';
				html +='<tr><td>备注：</td>';
				html +='<td><a>'+JSON.parse(sessionStorage.getItem(0)).remarks+'</a></td></tr>';
				html +='<tr><td>联系方式：</td>';
				html +='<td><a>'+JSON.parse(sessionStorage.getItem(0)).number+'</a></td></tr>';
				html +='<tr><td>验证码：</td>';
				html +='<td><a>'+JSON.parse(sessionStorage.getItem(0)).identify+'</a></td>';
				html +=' </tr> </thread> </table> </div>';
				$('#taketime').html(html);
			}else {
				var html = "";
				html +='<div class=\"pd-20\">';
				html +='<table class=\"layui-table\">';
				html +='<thead>';
				html +='<tr>';
				html +='<td>取货时间：</td>';
				html +='<td><a>'+JSON.parse(sessionStorage.getItem(0)).taketime+'</a></td></tr>';
				html +='<tr><td>备注：</td>';
				html +='<td><a>'+JSON.parse(sessionStorage.getItem(0)).remarks+'</a></td></tr>';
				html +='<tr><td>验证码：</td>';
				html +='<td><a>'+JSON.parse(sessionStorage.getItem(0)).identify+'</a></td>';
				html +=' </tr> </thread> </table> </div>';
				$('#taketime').html(html);
			}
			   sessionStorage.clear();   
		}
	</script>
    </body>

</html>